<?php 
include('../Connections/KRAPPERCON.php');
//include('../Connections/Accesos.php');
$oper = getVal('oper');

if ($oper == 'list'){
$sql = 'call sp_getAllServicios();';

$res = $mysqli->exeQuery($sql);
$return = getVal('return');
$a1 = '';
$a2 = '';
if (trim($return)!=""){
$a1 = '<span class="lnk a" onclick="selServ(this)">';
$a2 = '</span>';
}
if ($res){
?>
<table width="100%" class="tableIn tblSort" cellspacing="0" cellpadding="0" rules="all" border="1">
<thead>
  <tr>
    <th scope="col">ID</th>
    <th scope="col">Descripción</th>
    <th scope="col">Precio(inc/IGV)</th>
    <th scope="col">Moneda</th>
    <th scope="col">Válido de</th>
    <th scope="col">Válido hasta</th>
  </tr>
  </thead>
  <tbody>
  <?php     
  while($row = $res->fetch_assoc()){
  ?>
  <tr>
    <td><?php echo $a1.$row['ServID'].$a2;?></td>
    <td class="b"><?php echo $row['desDetSer'];?></td>
    <td class="c"><?php echo $row['impSerMan'];?></td>
    <td class="d"><?php echo $row['MoneyID'];?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
	<?php 
	}
	?>
    </tbody>
</table>
<?php 		
	}
}
?>
<script type="text/javascript">
function selServ(obj){
	var fila = $(obj).parent().parent();
	var srv = { id : fila.find('.a').text(),
				 nom : fila.find('.b').text(),
				 pre : fila.find('.c').text(),
				 mon : fila.find('.d').text()
				 };
	<?php
	if ($a1 != ""){
	echo $return."(srv);";
	}
	?>		 
		closePopup();
		closexPopup();
}
</script>
